<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>修改</title>
    <link href="__STATIC__/component/pear/css/pear.css" rel="stylesheet"/>
</head>
<body class="childrenBody {:dialog_css()}" style="padding-top:0;">

<form class="layui-form edit-form" method="post" action="{:url('edit')}">
    <input type="hidden" name="id" value="{$vo.id}">

    <div class="layui-tab layui-tab-brief" style="margin-top:0;">
        <ul class="layui-tab-title">
            <li class="layui-this">基本</li>
            <li>显示</li>
            <li>模型</li>
        </ul>
        <div class="layui-tab-content">
            <!-- 基本 -->
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-item-required">标签</label>
                    <div class="layui-input-block">
                        <input type="text" name="label" lay-verify="required" placeholder="标签名" value="{$vo.label}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-item-required">类型</label>
                    <div class="layui-input-inline w150">
                        {:form_select('field_type', config_get('cms.field_type', []), $vo['field_type'])}
                    </div>
                    <div class="layui-form-mid"> 长度</div>
                    <div class="layui-input-inline w100">
                        <input type="text" name="field_length" placeholder="字段长度" value="{$vo.field_length}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-item-required">标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="field_title" lay-verify="required" placeholder="中文字段标题" value="{$vo.field_title}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-item-required">名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="field_name" lay-verify="required" placeholder="英文字段名称" value="{$vo.field_name}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">默认值</label>
                    <div class="layui-input-block">
                        <input type="text" name="field_value" placeholder="留空为''，null为不设置" value="{$vo.field_value}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">其他</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="is_required" value="0">
                        <input type="hidden" name="is_unsigned" value="0">
                        <input type="hidden" name="is_index" value="0">
                        <input type="checkbox" name="is_required" title="必填" value="1" lay-skin="primary" {if $vo['is_required']==1:} checked{/if}>
                        <input type="checkbox" name="is_unsigned" title="正数" value="1" lay-skin="primary"{if $vo['is_unsigned']==1:} checked{/if}>
                        <input type="checkbox" name="is_index" title="索引" value="1" lay-skin="primary"{if $vo['is_index']==1:} checked{/if}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">注释</label>
                    <div class="layui-input-block">
                        <input type="text" name="field_comment" placeholder="注释 默认：标题" value="{$vo.field_comment}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">显示</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="show_list" value="0">
                        <input type="hidden" name="show_add" value="0">
                        <input type="hidden" name="show_edit" value="0">
                        <input type="checkbox" name="show_list" title="列表" value="1" lay-skin="primary" {if $vo['show_list']==1:} checked{/if}>
                        <input type="checkbox" name="show_add" title="添加" value="1" lay-skin="primary" {if $vo['show_add']==1:} checked{/if}>
                        <input type="checkbox" name="show_edit" title="修改" value="1" lay-skin="primary" {if $vo['show_edit']==1:} checked{/if}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">排序值</label>
                    <div class="layui-input-block">
                        <input type="number" name="sort" value="{$vo.sort}" min="0" step="10" lay-affix="number" placeholder="数字排序值" class="layui-input">
                    </div>
                </div>
            </div>
            <!-- 显示 -->
            <div class="layui-tab-item">
                <div class="layui-form-item">
                    <label class="layui-form-label">字段查询</label>
                    <div class="layui-input-block">
                        {:form_select('col_search', config_get('cms.col_search', 'true=true'), $vo['col_search'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">查询方式</label>
                    <div class="layui-input-block">
                        {:form_select('col_search_op', config_get('cms.col_search_op', ['='=>'=']), $vo['col_search_op'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">列表属性</label>
                    <div class="layui-input-block">
                        <input type="text" name="col_attr" placeholder="属性名=属性值|属性名=属性值(Layui表头属性)" value="{$vo.col_attr}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">列表模板</label>
                    <div class="layui-input-block">
                        <textarea name="col_tpl" placeholder="templet属性(Layui表头)" class="layui-textarea">{$vo.col_tpl}</textarea>
                    </div>
                </div>
                <hr style="border-color:#ddd;" />
                <div class="layui-form-item">
                    <label class="layui-form-label">表单类型</label>
                    <div class="layui-input-block">
                        {:form_select('form_type', config_get('cms.form_type', 'text=文本框', true), $vo['form_type'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">输入提示</label>
                    <div class="layui-input-block">
                        <input type="text" name="form_tips" placeholder="placeholder属性" value="{$vo.form_tips}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">默认值</label>
                    <div class="layui-input-block">
                        <input type="text" name="form_value" placeholder="表单默认值" value="{$vo.form_value}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">前端验证</label>
                    <div class="layui-input-block">
                        {:form_select('lay_verify', config_get('cms.lay_verify', 'none=无'), $vo['lay_verify'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">表单属性</label>
                    <div class="layui-input-block">
                        <textarea name="form_attr" placeholder="属性名=属性值|属性名=属性值(如有=和|符号可用[eq]和[or]代替)" class="layui-textarea">{$vo.form_attr}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">选项设置</label>
                    <div class="layui-input-block">
                        <textarea name="form_options" placeholder="选项值=选项名|选项值=选项名(如有=和|符号可用[eq]和[or]代替)" class="layui-textarea">{$vo.form_options}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">绑定字典</label>
                    <div class="layui-input-block">
                        {:form_select('dict_id', widget('dict')->get('',['get'=>'list']), $vo['dict_id'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">必填标记</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="form_required" value="0">
                        <input type="checkbox" name="form_required" value="1" {if $vo['form_required']==1:} checked{/if} lay-skin="switch" lay-text="是|否" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">容器样式</label>
                    <div class="layui-input-block">
                        <input type="text" name="input_style" placeholder="layui-input-block" value="{$vo.input_style}" class="layui-input">
                    </div>
                </div>
            </div>
            <!-- 模型 -->
            <div class="layui-tab-item">
                <div class="layui-form-item">
                    <label class="layui-form-label">自动验证</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="is_verify" value="0">
                        <input type="checkbox" name="is_verify" value="1" {if $vo['is_verify']==1:} checked{/if} lay-skin="switch" lay-text="开启|关闭" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">验证规则</label>
                    <div class="layui-input-block">
                        <input type="text" name="verify_rule" placeholder="验证规则|验证规则" value="{$vo.verify_rule}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">验证提示</label>
                    <div class="layui-input-block">
                        <input type="text" name="verify_msg" placeholder="验证提示|验证提示" value="{$vo.verify_msg}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">验证条件</label>
                    <div class="layui-input-inline w100">
                        {:form_select('verify_if', '1=必须|有值|空值|有字段|无字段', $vo['verify_if'])}
                    </div>
                    <div class="layui-form-mid"> 验证场景</div>
                    <div class="layui-input-inline w100">
                        {:form_select('verify_scene', '1=全部|新增|更新', $vo['verify_scene'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">自动处理</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="is_auto" value="0">
                        <input type="checkbox" name="is_auto" value="1" {if $vo['is_auto']==1:} checked{/if} lay-skin="switch" lay-text="开启|关闭" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">处理方式</label>
                    <div class="layui-input-block">
                        {:form_select('auto_method', 'string=填充字符|field=填充字段|function=函数处理|method=模型方法', $vo['auto_method'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">处理规则</label>
                    <div class="layui-input-block">
                        <input type="text" name="auto_rule" placeholder="处理规则|处理规则" value="{$vo.auto_rule}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">处理条件</label>
                    <div class="layui-input-inline w100">
                        {:form_select('auto_if', '1=必须|有值|空值|有字段|无字段', $vo['auto_if'])}
                    </div>
                    <div class="layui-form-mid"> 处理场景</div>
                    <div class="layui-input-inline w100">
                        {:form_select('auto_scene', '1=全部|新增|更新', $vo['auto_scene'])}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">自动过滤</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="is_filter" value="0">
                        <input type="checkbox" name="is_filter" value="1" lay-skin="switch" lay-text="开启|关闭" {if $vo['is_filter']==1:} checked{/if}/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">过滤条件</label>
                    <div class="layui-input-inline w100">
                        {:form_select('filter_if', '1=必须|有值|空值|有字段|无字段', $vo['filter_if'])}
                    </div>
                    <div class="layui-form-mid"> 过滤场景</div>
                    <div class="layui-input-inline w100">
                        {:form_select('filter_scene', '1=全部|新增|更新', $vo['filter_scene'])}
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script src="__STATIC__/component/layui/layui.js"></script>
<script src="__STATIC__/component/pear/pear.js"></script>
<script>
    layui.use(['aphpForm', 'aphp', 'form'], function () {
        var aphpForm = layui.aphpForm,
            aphp = layui.aphp,
            form = layui.form;

        //aphpForm.bindEvent('form.layui-form'); // 渲染表单

        form.on('submit(save)', function (data) {
            aphp.request.postForm(data, 0, function () {
                parent.layer.close(parent.layer.getFrameIndex(window.name));
                parent.layui.table.reload('currentTable');
            });
            return false;
        });
    })
</script>
</body>
</html>